<template>
  <div class="goods-info" v-if="Object.keys(goods).length !== 0">
    <div class="title">{{goods.title}}</div>
    <div class="price">
      <span class="newPrice">{{goods.newPrice}}</span>
      <span class="oldPrice">{{goods.oldPrice}}</span>
      <span class="discount" :style="{backgroundColor: goods.disColor}">{{goods.discount}}</span>
    </div>
    <div class="sell">
      <div>{{goods.columns[0]}}</div>
      <div>{{goods.columns[1]}}</div>
      <div>{{goods.services[goods.services.length - 1].name}}</div>
    </div>
    <div class="service">
      <div v-for="index in goods.services.length-1">
        <img :src="goods.services[index-1].icon" alt="">
        <span>{{goods.services[index-1].name}}</span>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: "DetailBaseInfo",
    props: {
      goods: {
        type: Object,
        default(){
          return {}
        }
      }
    }
  }
</script>

<style scoped>
.goods-info{
  padding: 8px;
  border-bottom: 6px solid #eee;
}
.title{
  color: #333;
  text-align: justify;
}
.price{
  margin-top: 10px;
}
.price span{
  margin-right: 5px;
}
.newPrice{
  color: var(--color-high-text);
  font-size: 20px;
}
.oldPrice{
  color: #999;
  font-size: 12px;
  text-decoration: line-through;
}
.discount{
  color: #fff;
  font-size: 12px;
  border-radius: 9px;
  padding: 2px 4px;
  vertical-align: 4px;
}
.sell{
  display: flex;
  margin-top: 20px;
  font-size: 12px;
  color: #999;
  border-bottom: 1px solid #efefef;
  padding-bottom: 12px;
}
.sell div, .service div{
  flex: 1;
  text-align: center;
}
.sell div:first-child, .service div:first-child{
  text-align: left;
}
.sell div:last-child, .service div:last-child{
  text-align: right;
}
.service{
  font-size: 12px;
  color: #333;
  display: flex;
  padding: 20px 0 12px;
}
.service img{
  width: 14px;
  vertical-align: middle;
}
</style>